package com.cat.state.after;

/**
 * @author cat
 * @version 2025/5/27 14:45
 * @description 环境角色类
 * @since JDK17
 */

public class Context {
    // 定义对应状态的常量
    public final static OpeningState openingState = new OpeningState();
    public final static ClosingState closingState = new ClosingState();
    public final static RunningState runningState = new RunningState();
    public final static StoppingState stoppingState = new StoppingState();

    // 定义一个变量表示当前状态
    public LiftState liftState;

    public void setLiftState(LiftState liftState) {
        this.liftState = liftState;
        this.liftState.setContext(this);
    }

    // 四种状态
    public void open() {
        liftState.open();
    }

    public void close() {
        liftState.close();
    }

    public void run() {
        liftState.run();
    }

    public void stop() {
        liftState.stop();
    }


}
